<template>
    <div>
        <table>
            <tr>
                <td>名称</td>
                <td>图片</td>
                <td>讲师</td>
                <td>操作</td>
            </tr>
            <tr v-for="i in list">
                <td>{{i.name}}</td>
                <td><img :src="i.pic" width="100" height="100"></td>
                <td>{{i.tname}}</td>
                <router-link :to="{'path':'updatecourse',query:{'id':i.id}}">修改</router-link>
            </tr>
            <tr>
                 <van-pagination
                    v-model="currentPage"
                    :total-items="total"
                    :items-per-page='size'
                    @change='getlist'
                    />
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                list:[],
                total:0,
                size:3,
                currentPage:1
            }
        },
        methods:{
            getlist(p){
                this.currentPage = p
                this.$axios.get('courseM?page='+p+'&size='+this.size).then(res=>{
                        this.list = res.data.list
                        this.total = res.data.total
                })
            }
        },
        mounted(){
            this.getlist(1)
        }
    }
</script>

<style scoped>

</style>